import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:hippo_app/values/style_value.dart';

class AppDialog {
  static void showConfirmationDialog(
    BuildContext context,
    String title,
    String content,
    VoidCallback ok,
    VoidCallback cancel,
  ) {
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text(title, style: StyleValue.appDialogTitleStyle),
          content: Text(content, style: StyleValue.appDialogContentStyle),
          backgroundColor: Colors.white,
          titlePadding: EdgeInsets.only(
            left: 25,
            right: 25,
            top: 20,
            bottom: 10,
          ),
          actionsPadding: EdgeInsets.only(
            left: 25,
            right: 25,
            top: 0,
            bottom: 10,
          ),
          contentPadding: EdgeInsets.only(
            left: 25,
            right: 25,
            top: 0,
            bottom: 0,
          ),
          actions: <Widget>[
            TextButton(
              child: Text(
                AppLocalizations.of(context)!.confirmationDialogOkBtnLabel,
                style: StyleValue.appDialogOkBtnStyle,
              ),
              onPressed: () {
                ok();
              },
            ),
            TextButton(
              child: Text(
                AppLocalizations.of(context)!.confirmationDialogCancelBtnLabel,
                style: StyleValue.appDialogCancelBtnStyle,
              ),
              onPressed: () {
                cancel();
              },
            ),
          ],
        );
      },
    );
  }
}
